<?php
header("Content-type: text/html; charset=utf-8");
require("inc/common.inc.php");
$nowdate=date("Y-m-d");
$adate=date('Y-m-d',strtotime("$nowdate -7 day"));
if ($vpp_user_info==""){
	echo "|@#page#@|";
	exit();
}
$pagesize=intval($pagesize);
if ($pagesize==0){$pagesize=2;}

	if(empty($pageindex)){$pageindex=1;}
    $str=" and userid='$vpp_user_info[id]' ";
    $s="";
	if ($isuse!=""){
		$isuse=intval($isuse);
		$str.=" and isuse='$isuse' ";
		$s.="isuse=$isuse&";
	}
	

	$table=" mx_vpp_lingqu_yhq ";
	$order=" order by  createdate desc, id desc";
	$column=" * ";
	$biaoid="id";

	$c=$db->listcount($table,$str);

	$list=$db->list1($pageindex,$pagesize,$table,$column,$str,$order,$biaoid);

	if(!is_array($list) or $c==0 and $pageindex==1){
	  echo "|@#page#@|<center>暂无信息</center>";
	  exit();
	}
	else{
		$nowhavenum=($pagesize*($pageindex-1))+count($list);
		if ($nowhavenum<$c){echo "1";}
		echo "|@#page#@|";
		for($i=0;$i<count($list);$i++){
		$thisindex=($pageindex-1)*$pagesize+$i+1
		?>
		<li>
		<a href="yhq_show.php?id=<?php echo $list[$i]["yhqid"]?>&fromwxopenid=<?php echo $wxmxopenid;?>">
		<h1><?php echo $list[$i]["yhqname"];
		if ( $list[$i]["isuse"]==1){echo '<span class="red">[已使用]</span>';}
		?></h1>
		<h2><b>编号：</b><?php echo $list[$i]["yhqcode"]?></h2>
		<h2><b>有效期：</b><?php echo $list[$i]["startdate"]?> 至 <?php echo $list[$i]["enddate"]?></h2>
		<h2><b>领取时间：</b><?php echo $list[$i]["createdate"]?></h2>
		<?php if ( $list[$i]["isuse"]==1){?>
		<h2><b>使用时间：</b><?php echo $list[$i]["usedate"]?></h2>
		<?php }?>
		</a>
		<div class="clear"></div></li>
		<div class="clear"></div>
	<?php
		}
	}
?>